home *** CD-ROM | disk | FTP | other *** search
/ PC Media 7 / PC MEDIA CD07.iso / share / prog / cm / cmtstack.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-09-06  |  1.1 KB  |  32 lines

  1. // CmTStack.h
  2. // -----------------------------------------------------------------
  3. // Compendium - C++ Container Class Library
  4. // Copyright (C) 1992-1994, Glenn M. Poorman, All rights reserved
  5. // -----------------------------------------------------------------
  6. // Stack template definition.
  7. // -----------------------------------------------------------------
  8.  
  9. #ifndef _CMTSTACK_H
  10. #define _CMTSTACK_H
  11.  
  12. #include <cm/include/cmtlist.h>
  13.  
  14. template <class T> class CmTStack : public CmTLinkedList<T> {
  15. public:
  16.   CmTStack() {}                                 // Default stack constructor.
  17.   CmTStack(const CmTStack<T>&);                 // Stack copy constructor.
  18.  ~CmTStack() {}                                 // Stack destructor.
  19.  
  20.   CmTStack<T>& operator=(const CmTStack<T>&);   // Assignment operator.
  21.  
  22.   Bool     push (const T&);                     // Push item onto stack.
  23.   T        pop  ();                             // Pop top item from stack.
  24.   const T& peek () const;                       // Return copy of top item.
  25. };
  26.  
  27. #if defined(__TURBOC__) || defined(__xlC__)
  28. #include <cm/include/cmtstack.cc>
  29. #endif
  30.  
  31. #endif
  32.